<%@ page pageEncoding="utf-8" isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<style type="text/css">
.error {
	display: inline;
	color: red;
	font-family: 黑体;
	font-size: 12px;
}

.error2 {
	color: red;
	font-family: 黑体;
	font-size: 12px;
}

.checkboxLabel {
	display: inline;
	font-size: 18px;
}
</style>
<script type="text/javascript">
	$("#permisForm").validator(
		{},
		{
			callback :function(results) {
			$("#permisForm").ajaxSubmit(function(data) {
				 permMyDialog.close();
	        	 permMyDialog = art.dialog({icon: data.success,content: data.message, lock:true});
	        	 
	        	 if(data.success=='succeed') {
	    			var newNode = {id:data.data.id, name:data.data.name, pId:data.data.parentPermisId};
	    	    			
	    	 		if (zTree.getSelectedNodes()[0]) {
	    				newNode.checked = zTree.getSelectedNodes()[0].checked;
	    				zTree.addNodes(zTree.getSelectedNodes()[0], newNode);
	    			} else {
	    				zTree.addNodes(null, newNode);
	    			} 
	        	 }
			});
		}
	});
	
	// 取消操作
	function cancelOpr() {
		permMyDialog.close();
		return false;
	}
	
	function checkPermisName() {
		var result = new Object();
		
		var pattern = new RegExp("[`~!@#$^&*=|{}':;',\\[\\].<>/?~！@#￥……&*（）——|{}【】‘；：”“'。，、？]");
		if($.trim($("#name").val()) != "" && $.trim($("#name").val()).match(pattern)) {
			result.result = false;
			result.msg = "不能包含特殊字符";
			return result;
		}
		
		result.result = true;
		result.msg = "输入正确";
		
		return result;
	}
	

</script>

<form id="permisForm" method="post" action="cms/permistree_manager/add/submit">
	<input id="parentPermisId" name="parentPermisId" type="hidden" type="text" value="${parentPermisId}"/>

	<ul class="all_list">
		<li id="orgTree001" class="dtree_frame" >
			<span class="all_title" style="width:120px;"> 父权限：</span> 
			<span class="conent">
				${parentPermisName }
			</span>
		</li>
		<li id="orgTree001" class="dtree_frame" >
			<span class="all_title" style="width:120px;"> 权限名称：</span> 
			<span class="conent">
				<input type="text" class="ui_input"
					id="name" name="name" value="" validator='{"label":"权限名称","required":true,"maxLength":25,"customFun":"checkPermisName"}'/>
			</span>
		</li>
		<li>
			<span class="all_title" style="width:120px;"> 权限代码：</span> 
			<span>
				<input type="text" class="ui_input"
						id="code" name="code" value="" validator='{"label":"权限代码","required":true,"maxLength":30}'/>
			</span>
		</li>
		<li>
			<span class="all_title" style="width:120px;"> 备注：</span> 
			<span>
				<textarea id="remark" name="remark" rows="4" cols="80" style="width:300px;margin-top:10px" 
					validator='{"label":"备注","required":false,"maxWordLength":160}'></textarea>
				<!-- <input type="text" class="ui_input"
					id="remark" name="remark" value="" validator='{"label":"备注","required":true,"maxLength":160}'/> -->
			</span>
		</li>
		<li>
			<span class="all_title"></span>
			<span> 
				<input type="button" class="btn_blue submitBtn" value="新 增" />
				<input type="button" class="btn_blue" value="取 消" name="button" id="cancel_button" onclick="cancelOpr()" /> 
			</span>
		</li>
	</ul>
	
</form>